package com.yhl.admin.controller;

import com.yhl.admin.bean.City;
import com.yhl.admin.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author yhl
 * @create 2021-06-28 10:23
 */
@Controller
public class CityController {

    @Autowired
    CityService cityService;

    @ResponseBody
    @PostMapping("/cityAdd")
    public City insertCity(City city){
        cityService.insertCity(city);
        return city;
    }

    @ResponseBody
    @GetMapping("/selectById")
    public City selectCity(@RequestParam("id")int id){
        City city = cityService.selectCity(id);
        return city;
    }


}
